package com.engine.salary.service.impl;

import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultTemplatePO;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultTemplateMapper;
import com.engine.salary.service.SalaryAcctResultTemplateService;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author Harryxzy
 * @ClassName SalaryAcctResultTemplateServiceImpl
 * @date 2024/03/26 15:30
 * @description
 */
public class SalaryAcctResultTemplateServiceImpl extends Service implements SalaryAcctResultTemplateService {

    private SalaryAcctResultTemplateMapper getSalaryAcctResultTemplateMapper() {
        return MapperProxyFactory.getProxy(SalaryAcctResultTemplateMapper.class);
    }
    @Override
    public List<SalaryAcctResultTemplatePO> listAll() {
        return getSalaryAcctResultTemplateMapper().listAll();
    }

    @Override
    public SalaryAcctResultTemplatePO getById(Long id) {
        return getSalaryAcctResultTemplateMapper().getById(id);
    }

    @Override
    public int insertIgnoreNull(SalaryAcctResultTemplatePO salaryAcctResultTemplate) {
        return getSalaryAcctResultTemplateMapper().insertIgnoreNull(salaryAcctResultTemplate);
    }

    @Override
    public int update(SalaryAcctResultTemplatePO salaryAcctResultTemplate) {
        return getSalaryAcctResultTemplateMapper().update(salaryAcctResultTemplate);
    }

    @Override
    public int updateIgnoreNull(SalaryAcctResultTemplatePO salaryAcctResultTemplate) {
        return getSalaryAcctResultTemplateMapper().updateIgnoreNull(salaryAcctResultTemplate);
    }

    @Override
    public int deleteById(Long id) {
        if (id == null) {
            return 0;
        }
        return getSalaryAcctResultTemplateMapper().deleteById(id);
    }

    @Override
    public int deleteByIds(List<Long> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return 0;
        }
        return getSalaryAcctResultTemplateMapper().deleteByIds(ids);
    }

    @Override
    public List<SalaryAcctResultTemplatePO> listBySalarySobId(Long salarySobId,List<Integer> types) {
        if (salarySobId == null) {
            return Collections.emptyList();
        }
        return getSalaryAcctResultTemplateMapper().listSome(SalaryAcctResultTemplatePO.builder().salarySobId(salarySobId).types(types).build());
    }
}
